<template>
	<div>
		<!-- 代理账号信息 -->
		<div class="block pl0 pr0">
			<p class="name">
				{{
					$t(
						'funds.fund_audit.agent_withdrawal_review_detail_title_2'
					)
				}}
			</p>
			<div class="block-content">
				<el-table
					border
					size="mini"
					:data="[1]"
					style="width: 100%"
					:header-cell-style="getRowClass"
				>
					<el-table-column
						align="center"
						:label="$t('funds.proxy_name')"
					>
						<template>
							{{ proxyAccountInfo.userName || '-' }}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('funds.fund_audit.parent_proxy_account')"
					>
						<template>
							{{ proxyAccountInfo.parentProxyName || '-' }}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('common.belong_merchant')"
					>
						<template>
							{{ proxyAccountInfo.merchantName || '' }}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('common.account_status')"
					>
						<template>
							<span
								v-if="proxyAccountInfo.loginLockStatus === 1"
								class="disableRgba"
							>
								{{ $t('common.login_lock_status') }}
							</span>
							<span
								v-if="proxyAccountInfo.paymentLockStatus === 1"
								class="deleteRgba"
							>
								{{ $t('common.account_lock_status') }}
							</span>
							<span
								v-if="
									proxyAccountInfo.loginLockStatus === 0 &&
										proxyAccountInfo.paymentLockStatus === 0
								"
								class="normalRgba"
							>
								{{ $t('common.account_status_normal') }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('funds.fund_audit.register_time')"
					>
						<template>
							{{ proxyAccountInfo.createdAt || '-' }}
						</template>
					</el-table-column>
				</el-table>
			</div>
		</div>
		<!-- 应收返点统计 -->
		<div class="block rebate-details pl0 pr0">
			<p class="name flex-between">
				<span>
					{{
						isAudit
							? getFormateDate(detailData.reportYm, 'ym')
							: getFormateDate(detailData.reportYm)
					}}{{ $t('期应收返佣统计') }}
				</span>
				<slot name="operateButton"></slot>
			</p>
			<div class="block-content">
				<el-table
					border
					size="mini"
					:data="proxyRebateDetail"
					style="width: 100%"
					:header-cell-style="getRowClass"
				>
					<el-table-column
						align="center"
						:label="`${$t('funds.proxy_name')}`"
						prop="proxyName"
					>
						<template slot-scope="scope">
							{{ scope.row.proxyName || '-' }}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('funds.fund_audit.commission_state')"
						prop="proxyStatus"
					>
						<template slot-scope="scope">
							{{
								getTypeName(
									scope.row.payoutStatus,
									commissionPayoutStatus
								)
							}}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="
							`${$t('funds.fund_audit.adjust_team_commission')}`
						"
						prop="commissionAmount"
					>
						<template slot-scope="scope">
							{{
								handleNumber(
									detailData.currency,
									scope.row.commissionAmount +
										scope.row.commissionAdjustAmount
								)
							}}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="`${$t('funds.fund_audit.commission_adjust')}`"
						prop="commissionAdjustAmount"
					>
						<template slot-scope="scope">
							{{
								handleNumber(
									detailData.currency,
									scope.row.commissionAdjustAmount
								)
							}}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="`${$t('funds.fund_audit.team_commission')}`"
						prop="commissionAmount"
					>
						<template slot-scope="scope">
							{{
								handleNumber(
									detailData.currency,
									scope.row.commissionAmount
								)
							}}
						</template>
					</el-table-column>
				</el-table>
			</div>
		</div>
		<!-- 团队返佣明细 -->
		<div class="block rebate-details pl0 pr0">
			<p class="name">
				{{ $t('funds.fund_audit.team_commission_detail') }}
			</p>
			<div class="block-content">
				<!-- 德州-俱乐部 -->
				<CommissionDetailTable
					:isTexas="true"
					:tableData="tableCommissionDataTop"
				/>
				<!-- 德州-保险和其他场馆 -->
				<CommissionDetailTable :tableData="tableCommissionDataBottom" />
			</div>
		</div>
		<!-- 审核信息 -->
		<div
			v-if="
				proxyRebateAuditInfo[0] && proxyRebateAuditInfo[0].lockOperator
			"
			class="block rebate-details pl0 pr0 mb20"
		>
			<p class="name">
				{{ $t('funds.fund_audit.audit_info') }}
			</p>
			<div class="block-content">
				<el-row>
					<el-col :span="8" :offset="0">
						{{ $t('funds.fund_audit.audit_user_1') }}:
						{{
							(proxyRebateAuditInfo[0] &&
								proxyRebateAuditInfo[0].lockOperator) ||
								'-'
						}}
					</el-col>
					<el-col :span="8" :offset="0">
						{{ $t('funds.fund_audit.audit_time_1') }}:
						{{
							(proxyRebateAuditInfo[0] &&
								proxyRebateAuditInfo[0].auditTime) ||
								'-'
						}}
					</el-col>
					<el-col :span="8" :offset="0">
						{{ $t('funds.fund_audit.audit_remark_1') }}:
						<span class="txtfeed world_break">
							{{
								(proxyRebateAuditInfo[0] &&
									proxyRebateAuditInfo[0].auditDesc) ||
									'-'
							}}
						</span>
					</el-col>
				</el-row>
			</div>
			<div
				v-if="
					proxyRebateAuditInfo[1] &&
						proxyRebateAuditInfo[1].lockOperator
				"
				class="block-content"
			>
				<el-row>
					<el-col :span="8" :offset="0">
						{{ $t('funds.fund_audit.audit_user_2') }}:
						{{
							(proxyRebateAuditInfo[1] &&
								proxyRebateAuditInfo[1].lockOperator) ||
								'-'
						}}
					</el-col>
					<el-col :span="8" :offset="0">
						{{ $t('funds.fund_audit.audit_time_2') }}:
						{{
							(proxyRebateAuditInfo[1] &&
								proxyRebateAuditInfo[1].auditTime) ||
								'-'
						}}
					</el-col>
					<el-col :span="8" :offset="0">
						{{ $t('funds.fund_audit.audit_remark_2') }}:
						<span class="txtfeed world_break">
							{{
								(proxyRebateAuditInfo[1] &&
									proxyRebateAuditInfo[1].auditDesc) ||
									'-'
							}}
						</span>
					</el-col>
				</el-row>
			</div>
		</div>
	</div>
</template>

<script>
import list from '@/mixins/list'
import { commissionPayoutStatus } from '@/dict/funds'
import CommissionDetailTable from './components/CommissionDetailTable'
export default {
	components: { CommissionDetailTable },
	mixins: [list],
	props: {
		isAudit: {
			type: Boolean,
			default: false
		},
		detailData: {
			type: Object,
			default: () => {}
		},
		// 本期返点明细
		proxyRebateDetail: {
			type: Array,
			default: () => {}
		},
		proxyAccountInfo: {
			type: Object,
			default: () => {}
		},
		tableCommissionDataTop: {
			type: Array,
			default: () => {}
		},
		tableCommissionDataBottom: {
			type: Array,
			default: () => {}
		},
		proxyRebateAuditInfo: {
			type: Array,
			default: () => {}
		}
	},
	data() {
		return {
			commissionPayoutStatus
		}
	}
}
</script>

<style lang="scss" scoped>
.block {
	padding: 30px 30px 0px 30px;
	margin-right: 15px;
	.name {
		font-weight: 600;
	}
	.block-content {
		position: relative;
		width: 100%;
		margin-top: 15px;
	}
	.rebate-details {
		padding-bottom: 20px;
		.details-page {
			margin-top: 10px;
			position: absolute;
			right: 0;
		}
	}
}
.txtfeed {
	width: 160px;
	table-layout: fixed;
	word-break: break-all;
	overflow: hidden;
}
</style>
